| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 28 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | const gulp = require('gulp') | ||
| 6 | module.exports = function (config) { | ||
| 7 |   gulp.task('replaceVersion', function (cb) { | ||
| 8 |     try { | ||
| 9 | // read current version from package.json | ||
| 10 | config.replaceVersion.php.to = pjson.version | ||
| 11 |       gutil.log(`Replacing ${config.replaceVersion.php.from} with ${config.replaceVersion.php.to} in all PHP files.`) | ||
| 12 | const changedFilesPhp = replace.sync(config.replaceVersion.php) | ||
| 13 |       for (const file of changedFilesPhp) { | ||
| 14 |         gutil.log(`Updated ${file}`) | ||
| 15 | } | ||
| 16 | |||
| 17 | // replace WordPress theme version in style.css | ||
| 18 |       gutil.log('Updating WordPress theme version.') | ||
| 19 | config.replaceVersion.wordpress.to += pjson.version | ||
| 20 | const changedFilesWp = replace.sync(config.replaceVersion.wordpress) | ||
| 21 |       if (changedFilesWp.length > 0) { | ||
| 22 |         for (const file of changedFilesWp) { | ||
| 23 |           gutil.log(`Updated ${file}`) | ||
| 24 | } | ||
| 25 |       } else { | ||
| 26 |         gutil.log(gutil.colors.yellow('No changes made! Was the version already changed?')) | ||
| 27 | } | ||
| 28 |     } catch (error) { | ||
| 29 |       gutil.error('An error occurred:', error) | ||
| 30 | } | ||
| 31 | cb() | ||
| 32 | }) | ||
| 33 | } | ||
| 34 |